import Vue from 'vue'
import Router from 'vue-router'
import Layout from 'view/layout/Layout'
const _import = require('./_import_' + process.env.NODE_ENV)

Vue.use(Router)

export const constantRouterMap = [
  {path: '/login', component: _import('session/Login'), hidden: true},
  {path: '/404', component: _import('error/404'), hidden: true},
  {path: '/401', component: _import('error/401'), hidden: true},
  {
    path: '',
    component: Layout,
    redirect: '/home',
    name: '',
    icon: 'homepage',
    noDropdown: true,
    children: [
      {
        icon: 'el-icon-menu', name: '首页', path: 'home', component: _import('home/Index')
      }
    ]
  },
  {
    path: '/example',
    component: Layout,
    redirect: '/example/table',
    name: '示例',
    icon: 'other',
    children: [
      {
        icon: 'workbench', path: 'table', component: _import('example/Table'), name: '表格'
      },
      {
        icon: 'order', path: 'form', component: _import('example/Form'), name: '表单'
      }
    ]
  },
  {path: '*', redirect: '/404', hidden: true}
]

export default new Router({
  routes: constantRouterMap
})
